<?php
  require_once("../lib/activecalendar/source/activecalendar.php");
  require_once("../conf/conf.inc.php");
  require_once("../lib/util.lib.php");
  require_once("class/Evenement.class.php");
  
  $mode_archive = isset($_GET["archives"]);
  
  $evenements = Evenement::getListeEvenement($mode_archive);
  $cal = new activeCalendar("2008");
  genererCalendrier($evenements,$cal);


  function genererCalendrier($evenements,&$cal){
    $myurl=$_SERVER['PHP_SELF']; 
    foreach($evenements as $evenement){
       $cal->setEventRange($evenement["debut"],$evenement["fin"],false,"edit_evenement.php?id={$evenement["id"]}","title='{$evenement["titre"]}'");
      $date_debut = convertToArray($evenement["debut"]);
      $date_fin = convertToArray($evenement["fin"]);
      $date_debut_inscription = $evenement["debut_inscription"];
      $date_fin_inscription = $evenement["fin_inscription"];
      
    //  $evenement["nom_referent"];
    } 
  }
?>
<html>
  <head>
    <link type="text/css" rel="stylesheet" href="../style/admin.css" />
  </head>
  <body>
    <table cellpadding="0" cellspacing="0" border="0" align="center" class="liste_evenement">
      <tr><th class="yearname">
        <div style="float:right; position:relative;">
          <select size="1" name="annee">
            <option>2006</option>
            <option>2007</option>
            <option>2008</option>
            <option>2009</option>
          </select>
        </div>
        Planification des &eacute;v&eacute;nements
      </th></tr>
<?php
  echo   "
      <tr><td>";        
       echo $cal->showYear();

  echo "
      </td></tr>";

 ?>      
       <tr>
         <td align="center">
           <a href="edit_evenement.php?id=new">Ajouter un &eacute;v&eacute;nement</a> |
           <?php 
           if (!$mode_archive)
              echo '<a href="evenement.php?archives">Consulter les archives</a><br />';
           else 
              echo '<a href="evenement.php">Consulter les événements actifs</a><br />';
           ?>
           <br />
           <a href="index.php">Retour</a>
         </td>
       </tr>
    </table>
  
  </body>
</html>